package core;

public class Person {
	private String name;
	private String surName;
	private String nation;
	private String country;
	private String bowCathegory;
	private String ageClass;
	private String club;
	private String gender;
	private boolean license;
	private boolean countryRating;
	private String birthdate;

	public Person(String name, String surName, String nation, String country, String bowCathegory, String ageClass, String club, String gender, boolean license, boolean countryRating, String birthdate) {
		super();
		this.name = name;
		this.surName = surName;
		this.nation = nation;
		this.country = country;
		this.bowCathegory = bowCathegory;
		this.ageClass = ageClass;
		this.club = club;
		this.gender = gender;
		this.license = license;
		this.countryRating = countryRating;
		this.birthdate = birthdate;
	}

	public Person() {
		this.name = "";
		this.surName = "";
		this.nation = "";
		this.country = "";
		this.bowCathegory = "";
		this.ageClass = "";
		this.club = "";
		this.gender = "";
		this.license = false;
		this.countryRating = false;
		this.birthdate = "";
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurName() {
		return this.surName;
	}

	public void setSurName(String surName) {
		this.surName = surName;
	}

	public String getNation() {
		return this.nation;
	}

	public void setNation(String nation) {
		this.nation = nation;
	}

	public String getCountry() {
		return this.country;
	}

	public void setCountry(String country) {
		this.country = country;
	}

	public String getBowCathegory() {
		return this.bowCathegory;
	}

	public void setBowCathegory(String bowCathegory) {
		this.bowCathegory = bowCathegory;
	}

	public String getAgeClass() {
		return this.ageClass;
	}

	public void setAgeClass(String ageClass) {
		this.ageClass = ageClass;
	}

	public String getClub() {
		return this.club;
	}

	public void setClub(String club) {
		this.club = club;
	}

	public String getGender() {
		return this.gender;
	}

	public void setGender(String gender) {
		this.gender = gender;
	}

	public boolean isLicense() {
		return this.license;
	}

	public void setLicense(boolean license) {
		this.license = license;
	}

	public boolean isCountryRating() {
		return this.countryRating;
	}

	public void setCountryRating(boolean countryRating) {
		this.countryRating = countryRating;
	}

	public String getBirthdate() {
		return this.birthdate;
	}

	public void setBirthdate(String birthdate) {
		this.birthdate = birthdate;
	}

	@Override
	public String toString() {
		StringBuilder output = new StringBuilder();
		output.append("Name: ");
		output.append(this.getName());
		output.append("\n");
		output.append("Vorname: ");
		output.append(this.getSurName());
		output.append("\n");
		output.append("Nation: ");
		output.append(this.getNation());
		output.append("\n");
		output.append("Bundesland: ");
		output.append(this.getCountry());
		output.append("\n");
		output.append("Altersklasse: ");
		output.append(this.getAgeClass());
		output.append("\n");
		output.append("Bogenkategorie: ");
		output.append(this.getBowCathegory());
		output.append("\n");
		output.append("Verein: ");
		output.append(this.getClub());
		output.append("\n");
		output.append("Geschlecht: ");
		output.append(this.getGender());
		output.append("\n");
		output.append("Lizenz: ");
		if (this.isLicense()) {
			output.append("ja");
		} else {
			output.append("nein");
		}
		output.append("\n");
		output.append("Landeswertung: ");
		if (this.isCountryRating()) {
			output.append("ja");
		} else {
			output.append("nein");
		}
		output.append("\n");
		output.append("Geburtsdatum: ");
		output.append(this.getBirthdate());
		output.append("\n");
		return output.toString();
	}

	@Override
	public boolean equals(Object person) {
		if (person instanceof Person) {

			if (!this.getName().equals(((Person) person).getName())) {
				return false;
			}
			if (!this.getSurName().equals(((Person) person).getSurName())) {
				return false;
			}
			if (!this.getNation().equals(((Person) person).getNation())) {
				return false;
			}
			if (!this.getCountry().equals(((Person) person).getCountry())) {
				return false;
			}
			if (!this.getBowCathegory().equals(((Person) person).getBowCathegory())) {
				return false;
			}
			if (!this.getAgeClass().equals(((Person) person).getAgeClass())) {
				return false;
			}
			if (!this.getClub().equals(((Person) person).getClub())) {
				return false;
			}
			if (!this.getGender().equals(((Person) person).getGender())) {
				return false;
			}
			if (this.isLicense() != ((Person) person).isLicense()) {
				return false;
			}
			if (this.isCountryRating() != ((Person) person).isCountryRating()) {
				return false;
			}
			// if (!this.getBirthdate().equals(((Person)
			// person).getBirthdate())) {
			// return false;
			// }

			return true;
		} else {
			return false;
		}

	}

	public Object [] toArray() {
		return new Object [] { this.getName(), this.getSurName(), this.getNation(), this.getCountry(), this.getBowCathegory(), this.getAgeClass(), this.getClub(), this.getGender(), this.isLicense(),
				this.isCountryRating(), this.getBirthdate() };
	}

	public Object [] toArrayPlusID(int id) {
		return new Object [] { id, this.getName(), this.getSurName(), this.getNation(), this.getCountry(), this.getBowCathegory(), this.getAgeClass(), this.getClub(), this.getGender(),
				this.isLicense(), this.isCountryRating(), this.getBirthdate() };
	}
}
